<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <cpn @item_click='itemClick'></cpn>
  </div>
  <template id="cpn">
    <div>
      <button v-for='item in menus' @click='btnClick(item)'>{{item.name}}</button>
    </div>
  </template>
  <script src="../../vue.js"></script>
  <script>


    new Vue({
      el: '#app',
      methods: {
        itemClick(val) {
          console.log(val);
        }
      },
      components: {
        cpn: {
          template: '#cpn',
          data() {
            return {
              menus: [
                { id: 'aaa', name: '科技一揽子' },
                { id: 'bbb', name: '水果一揽子' },
                { id: 'ccc', name: '鸡蛋一揽子' },
                { id: 'ddd', name: '书本一揽子' }
              ]
            }
          },
          methods: {
            btnClick(item) {
              this.$emit('item_click', item)
            }
          }
        }
      }
    })
  </script>
</body>

</html>